"use strict";

const {
  app: electronApp,
} = require("electron");

const Ps = require("ee-core/ps");
const Log = require("ee-core/log");


const { exampleService } = require('../service/example');
/**
 *
 * @class
 */
class ApiController {
  async index() {
    return "Hello,Index controller index method.";
  }
  info() {

    let data = {
      message: "测试路径信息",
      'electronApp.getAppPath()': electronApp.getAppPath(),
      'Ps.getRootDir()':Ps.getRootDir(),
      'Ps.getElectronDir()': Ps.getElectronDir(),
      'Ps.getBaseDir()': Ps.getBaseDir(),
      'Ps.getUserHomeAppDir()': Ps.getUserHomeAppDir(),
      'Ps.getPublicDir()': Ps.getPublicDir(),
      'Ps.getHttpPort()': Ps.getHttpPort(),
      'Ps.getAppUserDataDir()': Ps.getAppUserDataDir(),
    };
    let ret = {
      data: data,
      status: "success"
    };
    return ret;
  }
  

  /**
   * test
   */
  async testService() {
    const serviceResult2 = await exampleService.test("electron");
    Log.info("service result2:", serviceResult2);

    return;
  }

}

ApiController.toString = () => "[class ApiController]";
module.exports = ApiController;
